<?php
/**
 * Created by PhpStorm.
 * User: zhangbing
 * Date: 2017/3/16 0016
 * Time: 17:00
 */
namespace app\admin\validate;
use think\Validate;

class RechargeType extends Validate{
    //定义验证规则
    protected $rule = [
        'product' => 'require|max:255',
        'price'   => 'require|max:11|integer',
        'coin'    => 'require|max:11|integer',
    ];

    //定义错误信息
    protected $message = [
        'product.require' => '产品编号不能为空',
        'product.max'     => '产品编号不能超过255个字符',
        'price.require'   => '价格不能为空',
        'price.max'       => '价格不能超过11个字符',
        'coin.require'    => '价值不能为空',
        'coin.max'        => '价值不能超过11个字符',
    ];

    //验证场景
    protected $scene = [
        'add'  =>  ['product','price','coin'],
        'save'  =>  ['product','price','coin'],
    ];
}